import qs from 'qs';
import { RequestServerClass } from '@/util/request';

export class BhfbService {

  public rSerivce: any;

  constructor(opt: any, axiosFilterFn?: any) {
    this.rSerivce = new RequestServerClass(opt);
  }



  public getDemoData() {
    return new Promise((resolve, reject) => {
      const list: any = [];
      for (let i = 0; i < 10; i++) {
        list.push({
          id: `id${i}`,
          longitude: 116 + Math.random(),
          latitude: 39 + Math.random(),
        });
      }
      resolve(list);
    });
  }

  public getYjdwRealTime(opts?: any) {
    const url = '/resteamdyna/getLatestTeamDyna';
    return this.rSerivce.serverObj.post(url, opts);
  }
  public getYqEveryCount(opts?: any) {
    const url = '/epidemic/situation/daily';
    return this.rSerivce.serverObj.post(url + '?' + qs.stringify(opts));
  }
  // 区划树数据
  public getAreaData(opts?: any) {
    const url = '/districts/list?districtCode=' + opts.districtCode;
    return this.rSerivce.serverObj.post(url);
  }
  // 模糊查询区划数据
  public searchAreaData(opts?: any) {
    const url = '/districts/inquiry?word=' + opts.word;
    return this.rSerivce.serverObj.post(url);
  }

}
